<template name='tousu'>
	<view>
		<view style="width: 100%;height: 90%;display: flex;justify-content: center;align-items: center;">
			<view style="width: 96%;position: absolute; top:0; background-color: #FFFFFF;box-shadow: 1px 1px 5px #C0C0C0;padding-top: 20upx;">
				<!-- 数据列表 -->
				<view style="color: #606270;display: flex;width: 100%;justify-content: center;font-size: 15px;flex-direction: column;align-items: center;">
					<view style="border-bottom: 1px solid #EBEEF5;display: flex;flex-direction: row;width: 90%;background-color: #F5F7FA;padding: 10upx;">
						
						<view style="width: 15%;">
							项目ID
						</view>
						<view style="width: 15%;">
							项目名称
						</view>
						<view style="width: 10%;">
							投诉人
						</view>
						<!-- <view style="width: 10%;">
							投诉人id
						</view> -->
						<view style="width: 20%;">
							投诉内容
						</view>
						<view style="width: 10%;">
							投诉时间
						</view>
						<view style="width: 20%;">
							操作
						</view>
					</view>
					<view style="width: 90%;" v-for="(item,index) in tousuList" :key=index class="list_detail" >
						<view style="width: 15%;">
							{{item.task_id}} 
						</view>
						<view style="width: 15%;">
							{{item.task_name}} 
						</view>
						<view style="width: 10%;">
							{{item.user.username}}
						</view>
						<!-- <view style="width: 10%;">
							{{item.user.user_id}}
						</view> -->
						<view style="width: 20%;">
							{{item.tousu}}
						</view>
						<view style="width: 10%;">
							{{item.create_time}}
						</view>
						<view style="width: 20%;display: flex;flex-direction: row;">
							<view @click="stop(item)" class="alter" style="">
								停止该项目！
							</view>
							<view @click="diable_tousu(item)" class="delete" style="">
								忽略投诉
							</view>
							<!-- <view @click="delete_detail(item)" class="delete" style="">
								删除
							</view> -->
						</view>
					</view>
					
				</view>
				<!-- 数据列表end -->
			</view>
		</view>
		<!-- 编辑遮罩层 -->
		
	</view>
	
</template>

<script>
	import global from "@/common/global.js"
	import uniPopup from "@/components/uni-popup/uni-popup.vue"
	export default{
		name:'tousu',
		components: {
			uniPopup
		},
		data(){
			return{
				
			}
		},
		 // 此处定义传入的数据
		props: {
		    tousuList: {
		        type: Array,
		        value: []
		    },
		},
		
		methods:{
			
			diable_tousu:function(item){
				var that = this
				uni.showModal({
					title:'确认忽略该投诉吗？',
					content: item.tousu,
					confirmText: '确认忽略',
					cancelText: '取消操作',
					success: function (res) {
							if (res.confirm) {
								uni.request({
									url:global.baseUrl+'api/task/tousu_admin_disable',
									method: "POST",
									data:{
										tousu_id: item.tousu_id,
									},					
									success: function (res) {
										console.log(res)
											if(res.data.code == 10000){
												uni.showToast({
													icon: 'none',
													title:'操作成功',
													duration: 2000
												})
												
												  setTimeout(() => {
												    uni.navigateTo({
												        url: '/pages/admin/admin'
												      });
												  }, 1500);
											}else{
												uni.showToast({
													icon: 'none',
													title:'操作失败',
													duration: 2000
												})
											}
										}
									})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
							
						}
				})
				
			},
			stop:function(item){
				var that = this
				uni.showModal({
					title:'确定要停止该项目吗？',
					content: '项目名称：' + item.task_name,
					confirmText: '确认停止',
					cancelText: '取消操作',
					success: function (res) {
							if (res.confirm) {
								uni.request({
									url:global.baseUrl+'api/task/task_admin_status',
									method: "POST",
									data:{
										task_id: item.task_id,
										status: '众筹失败'
									},					
									success: function (res) {
										console.log(res)
											if(res.data.code == 10000){
												uni.showToast({
													icon: 'none',
													title:'操作成功',
													duration: 2000
												})
												
												  setTimeout(() => {
												    uni.navigateTo({
												        url: '/pages/admin/admin'
												      });
												  }, 1500);
											}else{
												uni.showToast({
													icon: 'none',
													title:'操作失败',
													duration: 2000
												})
											}
										}
									})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
							
						}
				})
				
			},
			
		}
	}
</script>

<style>
	.alter_sure:hover{
		border: 1upx solid #C8C7CC;
	}
	.alter_sure{
		margin-left: auto;height: 15upx;width: 15upx;padding: 5upx;
		border: 1px solid #FFFFFF;}
	.add_color{
		background-color: #1890FF;
		
	}
	.add_color:hover{
		background-color: #46A6FF;
	}
	.admin_pic{
		width: 180upx;
		height: 50upx;
		padding: 20upx;
	}
	.admin_pic:hover{
		background-color: #2C405A;
	}
	.arrow{
		height: 20upx;
		width: 20upx;
		
		margin-left: auto;
	}
	.arrow1{
		height: 18upx;
		width: 18upx;
		
	}
	.detail{
		padding: 20upx 20upx 20upx 40upx;
		width: 160upx;
		display: flex;
		flex-direction: row;
		color: #FFFFFF;
		font-size: 15px;
		align-items: center;
		
	}
	.detail:hover{
		background-color: #1890FF;
	}
	.list_detail{
		border-bottom: 1px solid #EBEEF5;display: flex;flex-direction: row;width: 100%;padding: 10upx;
	}
	.list_detail:hover{
		background-color: #F5F7FA;
	}
	.alter{
		color: #1890FF;
	}
	.alter:hover{
		text-decoration: underline;
		color: #DD524D;
	}
	.delete{
		color: #1890FF;margin-left: 10upx;
	}
	.delete:hover{
		text-decoration: underline;
		color: #DD524D;
	}
	.left{
		background-color: #F4F4F5;
		width: 15upx;
		height: 15upx;
		padding: 10upx;
	}
	.page{
		color: #FFFFFF;
		background-color: #1890FF;
		width: 32upx;
		height: 32upx;
		font-size: 15px;
		border-radius: 3upx;
		text-align: center;
		justify-content: center;
		display: flex;
		align-items: center;
		margin-left: 10upx;
	}
	.nopage{
		color: #FFFFFF;
		background-color: #F4F4F5;
		width: 32upx;
		height: 32upx;
		font-size: 15px;
		border-radius: 3upx;
		text-align: center;
		justify-content: center;
		display: flex;
		align-items: center;
		margin-left: 10upx;
		color: #606270;
	}
	.right{
		margin-left: 10upx;
		background-color: #F4F4F5;
		width: 15upx;
		height: 15upx;
		padding: 10upx;
	}
	.input_account{
		padding: 5upx 15upx 5upx 15upx;border: 1px solid #DCDFE6;width: 250upx;font-size: 13px;margin-left: 20upx;
	}
	.input_account:hover{
		border: 1px solid #C8C7CC;
	}
	.input_account1{
		padding: 5upx 15upx 5upx 15upx;border: 1px solid #DCDFE6;width: 227upx;font-size: 13px;margin-left: 20upx;
	}
	.input_confirm{
		border: 1px solid #1890FF;
		padding: 5upx 15upx 5upx 15upx;width: 250upx;font-size: 13px;margin-left: 20upx;
	}
	.back_color{
		background-color: #FF4D4F;
	}
	.back_color:hover{
		background-color: #FF7172;
	}
</style>
